/*
 * Copyright (c)e 2024-2024.Powered by neflibata
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

package com.liuzian.marketserver.controller;

import com.liuzian.marketserver.dto.R;
import com.liuzian.marketserver.entity.Orders;
import com.liuzian.marketserver.service.serviceImpl.OrdersServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/orders")
public class OrdersController {
    @Autowired
    private OrdersServiceImpl ordersServiceImpl;


    @PostMapping("/create")
    public R<Orders> create(@RequestBody Orders orders) {
      return ordersServiceImpl.create(orders);
    }

    @GetMapping("/pay")
    public R<String> pay(Long oid) {
        return ordersServiceImpl.pay(oid);
    }

    @GetMapping("/cancel")
    public R<String> cancel(Long oid) {
        return ordersServiceImpl.cancel(oid);
    }

    @GetMapping("/paid")
    public R<List<Orders>> paid(Long uid) {
        return ordersServiceImpl.paid(uid);
    }

    @GetMapping("/unPaid")
    public R<List<Orders>> unPaid(Long uid) {
       return ordersServiceImpl.unPaid(uid);
    }

    @GetMapping("/transit")
    public R<List<Orders>> transitOrder(Long uid) {
        return ordersServiceImpl.transitOrder(uid);
    }

    @GetMapping("/receive")
    public R<List<Orders>> receiveOrder(Long uid) {
        return ordersServiceImpl.receiveOrder(uid);
    }

    @GetMapping("/finish")
    public R<String> finishOrder(Long oid) {
        return ordersServiceImpl.finishOrder(oid);
    }
}
